package v1

import (
	"bc/dao"
	"encoding/json"
	"github.com/gin-gonic/gin"
)

func Routes(c *gin.Context){

	uid,exist := c.Get("uid")
	if !exist{
		c.JSON(200,gin.H{
			"code":500,
			"msg":"error",
			"data":"请重试",
		})
		return
	}

	w := dao.RuleIds(uid.(int))
	re := dao.Trees(w,dao.Node(0,dao.Source()))
	jsonstr,_ := json.Marshal(re)

	c.JSON(200,gin.H{
		"code":200,
		"msg":"操作成功",
		"data":string(jsonstr),
	})
}
